package com.my.ycv51.ycinit.config;


import com.my.ycv51.ycinit.en.ErrorCorrectionL;

/**
 * The configuration of the encoder encode.
 *
 * @Author MRH
 */
public class EncodeConfig {


    /**
     * The character set of the encoder
     */
    private String characterSet;

    /**
     * The error correction level of the encoder,ex:L,M,Q,H
     */
    private ErrorCorrectionL mErrorCorrectionLevel;


    /**
     * The margin to the picture edge
     */
    private int margin;


    /**
     * The white block of the generated picture
     */
    private int colorWhite;


    /**
     * The black block of the generated picture
     */
    private int colorBlack;

    private EncodeConfig() {
    }

    public String getCharacterSet() {
        return characterSet;
    }


    public ErrorCorrectionL getErrorCorrectionLevel() {
        return mErrorCorrectionLevel;
    }


    public int getMargin() {
        return margin;
    }


    public int getColorWhite() {
        return colorWhite;
    }


    public int getColorBlack() {
        return colorBlack;
    }


    @Override
    public String toString() {
        return "EncodeConfig{" +
                "characterSet='" + characterSet + '\'' +
                ", mErrorCorrectionLevel=" + mErrorCorrectionLevel +
                ", margin=" + margin +
                ", colorWhite=" + colorWhite +
                ", colorBlack=" + colorBlack +
                '}';
    }


    public static final class Builder {
        private EncodeConfig mEncodeConfig;

        public Builder() {
            this.mEncodeConfig = new EncodeConfig();
        }

        public Builder setCharacterSet(String characterSet) {
            this.mEncodeConfig.characterSet = characterSet;
            return this;
        }

        public Builder setErrorCorrectionLevel(ErrorCorrectionL mErrorCorrectionLevel) {
            this.mEncodeConfig.mErrorCorrectionLevel = mErrorCorrectionLevel;
            return this;
        }

        public Builder setMargin(int margin) {
            this.mEncodeConfig.margin = margin;
            return this;
        }

        public Builder setColorWhite(int colorWhite) {
            this.mEncodeConfig.colorWhite = colorWhite;
            return this;
        }

        public Builder setColorBlack(int colorBlack) {
            this.mEncodeConfig.colorBlack = colorBlack;
            return this;
        }

        public EncodeConfig build() {
            return mEncodeConfig;
        }

    }


}
